package model.entity;

import java.util.HashSet;

import model.ability.PassiveSkill;
import model.area_effect.Trap;
import model.core.AbilitiesLibrary;
import model.item.BrawlWeapon;
import model.item.OneHandedWeapon;
import model.item.RangedWeapon;
import model.item.StaffWeapon;
import model.item.TwoHandedWeapon;
import model.map.MapPoint;
import model.stats.StatsContainer;

public class Sneak extends Avatar{
	private PassiveSkill ranged;
	private PassiveSkill creep;
	private PassiveSkill pickPocket;
	private PassiveSkill disarmSkill;
	
	public Sneak(String name, MapPoint origin, StatsContainer stats,
			MovementType movement, int obs, int bar, int bind, DirectionalGraphicSet graphics){
		super(name, "smasher", origin, stats,
				movement, obs, bar, bind, graphics);
		ranged=new PassiveSkill("ranged");
		creep=new PassiveSkill("creep");
		pickPocket=new PassiveSkill("pickPocket");
		disarmSkill=new PassiveSkill("disarmTraps");
		defaultAttack=AbilitiesLibrary.getInstance().getMapAbility("fisting");
	}
	
	public Sneak(){
		super();
		ranged=new PassiveSkill("ranged");
		creep=new PassiveSkill("creep");
		pickPocket=new PassiveSkill("pickPocket");
		disarmSkill=new PassiveSkill("disarmTraps");
		defaultAttack=AbilitiesLibrary.getInstance().getMapAbility("fisting");
	}
	
	/**
	 * this method will define the generation of the level up window defining which properties 
	 * are to be leveled.
	 */
	public void levelup(){
		super.levelup();
		stats.levelAgility(3);
		stats.levelHardiness(2);
		stats.levelIntellect(2);
		stats.levelStrength(1);
	}
	/**
	 * Equip methods define how (or if) a class can equip the particular weapon type.
	 */
	public void equipOneHandedWeapon(OneHandedWeapon weapon){
		return;
	}
	
	public void equipTwoHandedWeapon(TwoHandedWeapon weapon){
		return;
	}
	
	public void equipBrawlingWeapon(BrawlWeapon weapon){
		return;
	}
	
	public void equipStaff(StaffWeapon weapon){
		return;
	}
	
	public void equipRangedWeapon(RangedWeapon weapon){
		super.equipRanged(weapon);
		defaultAttack=AbilitiesLibrary.getInstance().getMapAbility("ranged");
		defaultAttack.setGoverningSkill(ranged);
	}
	
	public void applyTrap(Trap trap){
		int skill = disarmSkill.getLevel();
		int rnd=(int) (Math.random()*20);
		if(rnd<skill)return;
		else trap.getEffect().doEffect(this);
	}

	public void enchant(int baseValue) {
	}
	
    public HashSet<PassiveSkill> getSkillList(){
    	HashSet<PassiveSkill> skillList=super.getSkillList();
    	skillList.add(creep);
    	skillList.add(ranged);
    	skillList.add(pickPocket);
    	skillList.add(disarmSkill);
    	return skillList;
    }
}
